<template>
  <svg xmlns="http://www.w3.org/2000/svg" 
    :width="_width" 
    :height="_height"
    :spin="spin"
    :rtl="rtl"
    viewBox="0 0 43 42"
    preserveAspectRatio="xMidYMid meet"
    fill="none"
    role="presentation"
    ref="host"
  >
    <g><g clip-path="url(#111905__a)"><path data-follow-fill="currentColor" d="M22.138 10.792h13.523c.418 0 .818.153 1.114.427.295.273.461.644.461 1.031v20.417c0 .386-.166.757-.461 1.03a1.641 1.641 0 0 1-1.114.428H7.311c-.418 0-.818-.154-1.114-.427a1.406 1.406 0 0 1-.46-1.031V9.333c0-.386.165-.757.46-1.03a1.641 1.641 0 0 1 1.114-.428h11.677l3.15 2.917Zm-7.477 10.937a4.103 4.103 0 0 0 2.784-1.068c.739-.683 1.154-1.61 1.154-2.578 0-.967-.415-1.894-1.154-2.578a4.103 4.103 0 0 0-2.784-1.068 4.103 4.103 0 0 0-2.784 1.068c-.739.684-1.153 1.611-1.153 2.578 0 .967.414 1.895 1.153 2.578a4.103 4.103 0 0 0 2.784 1.068Zm-6.3 7.292h12.6c0-1.547-.664-3.031-1.845-4.125-1.182-1.094-2.784-1.709-4.455-1.709-1.67 0-3.273.615-4.455 1.709-1.181 1.094-1.845 2.578-1.845 4.125Zm15.75-10.646V21h10.5v-2.625h-10.5Zm10.5 5.25h-10.5v2.625h10.5v-2.625Z" :fill="_fill"/></g><defs><clipPath id="111905__a"><path d="M0 0h31.5v31.5H0z" fill="#fff" transform="translate(5.736 5.25)"/></clipPath></defs></g>
  </svg>
</template>

<script lang="ts">
import { Vue, prop } from 'vue-class-component';

class Props {
    width = prop<number | string>({
      type: [Number, String],
      required: false
    })
    
    height = prop<number | string>({
      type: [Number, String],
      required: false
    })
    
    stroke = prop<string>({
      type: String,
      required: false
    })
    
    fill = prop<string>({
      type: String,
      required: false
    })
    
    color = prop<string>({
      type: String,
      required: false
    })
    
    spin = prop<boolean>({
      type: Boolean,
      required: false
    })
    
    rtl = prop<boolean>({
      type: Boolean,
      required: false
    })
    

  // optional prop with default
  size = prop<number | string>({ default: '1em' })
}

export default class IconPersonal extends Vue.with(Props) {
    get _fill(): string | undefined {
        return this.fill || this.color
    }
    get _stroke(): string | undefined {
        return this.stroke || this.color
    }
    get _width(): string | number {
      return this.width || this.size
    }
    get _height(): string | number {
      return this.height || this.size
    }
  mounted():void {
        if (!this._fill) {
            (this.$refs.host as HTMLElement)?.querySelectorAll('[data-follow-fill]').forEach(item => {
            item.setAttribute('fill', item.getAttribute('data-follow-fill') || '')
            })
        }
        if (!this._stroke) {
            (this.$refs.host as HTMLElement)?.querySelectorAll('[data-follow-stroke]').forEach(item => {
            item.setAttribute('stroke', item.getAttribute('data-follow-stroke') || '')
            })
        }
    }
    updated():void {
        if (!this._fill) {
            (this.$refs.host as HTMLElement)?.querySelectorAll('[data-follow-fill]').forEach(item => {
            item.setAttribute('fill', item.getAttribute('data-follow-fill') || '')
            })
        }
        if (!this._stroke) {
            (this.$refs.host as HTMLElement)?.querySelectorAll('[data-follow-stroke]').forEach(item => {
            item.setAttribute('stroke', item.getAttribute('data-follow-stroke') || '')
            })
        }
    }
}
</script>

<style scoped>
svg[spin="true"] {animation: iconpark-spin 1s infinite linear;}
svg[spin="true"][rtl="true"] {animation: iconpark-spin-rtl 1s infinite linear;}
svg[rtl="true"] {
  transform: scaleX(-1);
}
@keyframes iconpark-spin {
  0% { -webkit-transform: rotate(0); transform: rotate(0);} 100% {-webkit-transform: rotate(360deg); transform: rotate(360deg);}
}
@keyframes iconpark-spin-rtl {
  0% {-webkit-transform: scaleX(-1) rotate(0); transform: scaleX(-1) rotate(0);} 100% {-webkit-transform: scaleX(-1) rotate(360deg); transform: scaleX(-1) rotate(360deg);}
}
</style>
